package com.itheima.manager;

import com.itheima.common.R;
import com.itheima.domain.HomeRecommendProduct;
import com.itheima.service.IHomeRecommendProductService;
import com.itheima.vo.PageBeanVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

@Component
public class SmsHomeRecommendProductManager {


    @DubboReference
    IHomeRecommendProductService homeRecommendProductService;

    public R findByPage(Integer pageNum, Integer pageSize, String productName, Integer recommendStatus) {
        PageBeanVo byPage = homeRecommendProductService.findByPage(pageNum, pageSize, productName, recommendStatus);
        return R.success(byPage);

    }

    public R addNew(HomeRecommendProduct homeRecommendProduct) {
        homeRecommendProductService.addNew(homeRecommendProduct);

        return R.success(null);
    }

    public R delete(Integer[] ids) {
        homeRecommendProductService.delete(ids);
        return R.success(null);
    }

    public R update(Integer[] ids, Integer recommendStatus) {
        homeRecommendProductService.update(ids,recommendStatus);

        return R.success(null);
    }

    public R sort(Integer id, Integer sort) {
        homeRecommendProductService.sort(id,sort);
        return R.success(null);
    }
}
